{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Question 80\n",
    "\n",
    "### **Question**\n",
    "\n",
    "> **_Please write a program to print the list after removing even numbers in [5,6,77,45,22,12,24]._**\n",
    "\n",
    "---\n",
    "\n",
    "### Hints\n",
    "\n",
    "> **_Use list comprehension to delete a bunch of element from a list._**\n",
    "\n",
    "---\n",
    "\n",
    "\n",
    "\n",
    "**Solutions:**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def isEven(n):\n",
    "    return n % 2 != 0\n",
    "\n",
    "\n",
    "li = [5, 6, 77, 45, 22, 12, 24]\n",
    "lst = list(filter(isEven, li))\n",
    "print(lst)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**OR**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "li = [5, 6, 77, 45, 22, 12, 24]\n",
    "lst = list(filter(lambda n: n % 2 != 0, li))\n",
    "print(lst)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# Question 81\n",
    "\n",
    "### **Question**\n",
    "\n",
    "> **_By using list comprehension, please write a program to print the list after removing numbers which are divisible by 5 and 7 in [12,24,35,70,88,120,155]._**\n",
    "\n",
    "---\n",
    "\n",
    "### Hints\n",
    "\n",
    "> **_Use list comprehension to delete a bunch of element from a list._**\n",
    "\n",
    "---\n",
    "\n",
    "\n",
    "\n",
    "**Solutions:**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "li = [12, 24, 35, 70, 88, 120, 155]\n",
    "li = [x for x in li if x % 35 != 0]\n",
    "print(li)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# Question 82\n",
    "\n",
    "### **Question**\n",
    "\n",
    "> **_By using list comprehension, please write a program to print the list after removing the 0th, 2nd, 4th,6th numbers in [12,24,35,70,88,120,155]._**\n",
    "\n",
    "---\n",
    "\n",
    "### Hints\n",
    "\n",
    "> **_Use list comprehension to delete a bunch of element from a list.\n",
    "> Use enumerate() to get (index, value) tuple._**\n",
    "\n",
    "---\n",
    "\n",
    "\n",
    "\n",
    "**Solutions:**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "li = [12, 24, 35, 70, 88, 120, 155]\n",
    "li = [li[i] for i in range(len(li)) if i % 2 != 0]\n",
    "print(li)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# Question 83\n",
    "\n",
    "### **Question**\n",
    "\n",
    "> **_By using list comprehension, please write a program to print the list after removing the 2nd - 4th numbers in [12,24,35,70,88,120,155]._**\n",
    "\n",
    "---\n",
    "\n",
    "### Hints\n",
    "\n",
    "> **_Use list comprehension to delete a bunch of element from a list.\n",
    "> Use enumerate() to get (index, value) tuple._**\n",
    "\n",
    "---\n",
    "\n",
    "\n",
    "\n",
    "**Solutions:**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# to be written\n",
    "li = [12, 24, 35, 70, 88, 120, 155]\n",
    "li = [li[i] for i in range(len(li)) if i < 3 or 4 < i]\n",
    "print(li)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# Question 84\n",
    "\n",
    "### **Question**\n",
    "\n",
    "> **_By using list comprehension, please write a program generate a 3\\*5\\*8 3D array whose each element is 0._**\n",
    "\n",
    "---\n",
    "\n",
    "### Hints\n",
    "\n",
    "> **_Use list comprehension to make an array._**\n",
    "\n",
    "---\n",
    "\n",
    "**Solution:**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "array = [[[0 for col in range(8)] for col in range(5)] for row in range(3)]\n",
    "print array"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
